# generate the Input class header and cpp files for the fqmc program
add_custom_command( OUTPUT ${FORMIC_BINARY_DIR}/src/formic/fqmc/input.h
                           ${FORMIC_BINARY_DIR}/src/formic/fqmc/input.cpp
                    COMMAND input_options_generator
                            ${FORMIC_SOURCE_DIR}/src/formic/fqmc/input_options.txt
                            ${FORMIC_BINARY_DIR}/src/formic/fqmc/input.h
                            ${FORMIC_BINARY_DIR}/src/formic/fqmc/input.cpp
                            formic/fqmc/input.h
                            fqmc
                    WORKING_DIRECTORY ${FORMIC_BINARY_DIR}/src/formic/fqmc
                    DEPENDS ${FORMIC_SOURCE_DIR}/src/formic/fqmc/input_options.txt
                            input_options_generator
                    COMMENT "generating formic/fqmc/input.h and formic/fqmc/input.cpp"
                  )

add_library(formic_fqmc fqmc.cpp
                        command.cpp
                        vmc_walker.cpp
                        distance_proposer.cpp
                        energy.cpp
                        gradient.cpp
                        onepdm.cpp
                        s_squared.cpp
                        optimizer.cpp
                        linear_method.cpp
                        bfgs.cpp
                        diis.cpp
                        line_search.cpp
                        no_transform.cpp
                        rest_gem_pow.cpp
                        rgp_detail.cpp
                        all_pair_jast.cpp
                        orb_opt.cpp
                        orb_opt_acc.cpp
                        fortran/apj_fortran_transform.f90
                        fortran/rgp_fortran_der_hc_aaaa.f90
                        fortran/rgp_fortran_der_hc_aabb.f90
                        fortran/rgp_fortran_energy_aaaa.f90
                        fortran/rgp_fortran_energy_aabb.f90
                        fortran/rgp_fortran_misc.f90
                        fortran/rgp_loc_en_adj_der.f90
                        fortran/jrgp_loc_en_adj_der.f90
                        fortran/jrgp_loc_en_integral_der.f90
                        ${FORMIC_BINARY_DIR}/src/formic/fqmc/input.cpp
           )

target_link_libraries(formic_fqmc formic_lapack
                                  formic_numeric
                                  formic_random
                                  formic_input_base
                                  formic_output
                                  formic_timing
                                  formic_wfn
                                  formic_ham
                                  formic_hf
                                  formic_mpi
                                  formic_vector
                                  ${CMAKE_THREAD_LIBS_INIT}
                     )

add_executable(fqmc main.cpp)
target_link_libraries(fqmc formic_fqmc)

add_subdirectory(tests)

install(
        TARGETS
          fqmc
          formic_fqmc
        RUNTIME DESTINATION
          bin
        LIBRARY DESTINATION
          lib
        ARCHIVE DESTINATION
          lib
       )
